<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title><?php echo $title?></title>
<link rel="stylesheet" href="${staticServer}/inc/css/main.css" />
<link rel="stylesheet" href="${staticServer}/inc/css/page.css" />
<link rel="stylesheet" href="${staticServer}/css/ask.css" />
<script src="${staticServer}/inc/js/jquery.js"></script>
<script src="${staticServer}/inc/js/pageset.js"></script>
<script src="${staticServer}/inc/js/datepicker.js"></script>
<script src="${staticServer}/inc/js/city.js"></script>
<script src="${staticServer}/inc/js/htmlfilter.js"></script>
<script src="${staticServer}/inc/js/model_resp.js"></script>
<script src="${staticServer}/inc/js/submitter.js"></script>
<script src="${staticServer}/inc/js/consultants/consultant_client_quest.js?1.4"></script>
<script src="${staticServer}/js/web/consultant_client_state.js?1.2"></script>
<script src="${staticServer}/js/web/consultant_student_func.js?1.0"></script>
<script src="${staticServer}/js/web/consultant_client_first.js?2.1"></script>
<script src="${staticServer}/js/web/consultant_client_check.js?1.1"></script>
<script src="${staticServer}/js/t/ask_allot.js?1.2"></script>
<script>
$(function(){
	init_city( "province", "city", "${clientImp.province}","${clientImp.city}");
	
	$("#province").val("${clientImp.province}");
	$("#city").val("${clientImp.city}");
})
var infopad = parent.infopad;

	var updateClient = function(){
		var id=$("#id").val();
		var keyname = $("#keyname").val();
		var lianxi_name = $("#lianxi_name").val();
		if(lianxi_name=="" || lianxi_name==null){
			lianxi_name = '匿名';
		}
		var age = $("#age").val();
		var student_msg = $("#student_msg").val();
		var province = $("#province").val();
		var city = $("#city").val();
		var phone = $("#phone").val();
		var weixin = $("#weixin").val();
		var qq = $("#qq").val();
		var ip = $("#ip").html();
		var user = $("#user").val();
		var descs = $("#desc").html();
		$.post("${contextPath}/consu/consultant_import_client_to.json",{
			"id" : id,
			"keyname" : keyname,
			"lianxi_name" : lianxi_name,
			"age" : age,
			"student_msg" : student_msg,
			"province" : province,
			"city" : city,
			"phone" : phone,
			"weixin" : weixin,
			"qq" : qq,
			"ip" : ip,
			"user" : user,
			"descs" : descs
		},
		function(ms) {
			if(ms.msg=="0"){
				alert("抱歉，该咨询师今日分配已达上线！");
			}else if(ms.msg=="1"){
				alert("分配成功！");	
				window.self.location=document.referrer;
		
			}
		});
	}
$(function(){
	$("#sp_user_ipt").keyup(function(){
		var nickname = $("#sp_user_ipt").val();
		$.post("${contextPath}/admin/getUserBynickname.json", {
			"nickname" : nickname
		}, function(ms) {
			 if(ms.user!=null){
			 	var username = ms.user.username;
			 	$("#user").val(username);
			 }
			
		});
	});
});
</script>
</head>

<body>
<input type="hidden" id="keyname" value="${clientImp.keyname}">
<input type="hidden" id="id" value="${clientImp.id}">
	<div id="home_link">
		<ul>
			<li><?php echo WEB_NAME?></li>
			<li>&gt;</li>
			<li>问卷</li>
			<li>&gt;</li>
			<li class="current"><?php echo $title?></li>
		</ul>
	</div>
	<div id="caption">
		<ul>
		</ul>
	</div>
	<div id="container">
		<div id="title"></div>
		<table id="tbl_article">
			<tr>
				<th width="25%">客户昵称
					<p class="caption">客户填写的姓名</p>
				</th>
				<td width="75%"><span class="stress"><input id="lianxi_name" type="text" value="<#if clientImp.lianxi_name??>${clientImp.lianxi_name}<#elseif clientImp.nickname??>${clientImp.nickname}</#if>" /></span></td>
			</tr>
			<tr>
				<th width="25%">孩子年龄</th>
				<td width="75%"><input id="age" type="text" value="<#if clientImp.age?? || clientImp.age!="">${clientImp.age}</#if>" />岁</td>
			</tr>
			<tr>
				<th>孩子情况</th>
				<td><div id="student_msg" contenteditable="true">${clientImp.student_msg}</div>
					<p class="line"></p>
					<p class="caption">仅供后台标记、备注相关信息使用（会在查询列表中显示该备注）</p></td>
			</tr>
			<tr>
				<th width="25%">所在城市</th>
				<td width="75%">
					<select id="province"></select> <em class="caption">（省份）</em> 
					<select id="city"></select> <em class="caption">（城市）</em>
				</td>
			</tr>
			<tr>
				<th width="25%">联系方式</th>
				<td width="75%">
					<a title="" id="2j97hjrdxciq">
						<em class="caption">电话：</em><input id="phone" type="text" value="${clientImp.phone}" /> - 
						<em class="caption">QQ：</em><input id="qq" type="text" value="${clientImp.qq}" /> - 
						<em class="caption">微信：</em><input id="weixin" type="text" value="${clientImp.weixin}" />
					</a>
				<div class='rect'>
					<#if clist??>
					<#list clist as client>
					 <#if !client_has_next>
						<span class='quote'>提示：该联系方式在OA客户资源库中已经存在，请分配给相同的负责人，免于冲突。</span><br>
						<p class='line'></p>
						<b>客户名称/称呼：</b>${client.nickname}<br>
						<b>联系方式：</b>电话：${client.phone} - 邮箱：${client.email} - QQ：${client.qq}<br>
						<b>登记人：</b>${client.ueuser}<br>
						<b>负责人：</b><#if client.rawuser!="">${client.rawuser}<#else>${client.name}</#if> <a id='btnSelect' rel="<#if client.rawuser!="">${client.rawuser}<#else>${client.name}</#if>">[ 选为目标咨询师 ]</a><br>
					  </#if>
					</#list>
					<#else>
						<b style="color:red;">提示： 该联系方式在OA客户资源库中没有匹配。</b>
					</#if>
				</div></td>
			</tr>
			<tr>
				<th width="25%">IP 地址</th>
				<td width="75%">
					<code id="ip">${clientImp.ip}&nbsp;</code>
					<p class="line"></p>
					<p class="caption">此IP地址由系统在用户提交问卷时，自动分析所得，仅作参考</p></td>
			</tr>
			<tr>
				<th width="25%">推广人</th>
				<td width="75%">
					<code id="ip">${clientImp.tui_nickName}&nbsp;</code>
					<p class="line"></p>
					<p class="caption">可以根据推广人信息分配客户</p></td>
			</tr>
			<tr>
				<th width="25%">目标咨询师</th>
				<td width="75%">
					<select id="user">
						<option value="">-- 请选择目标 --</option>
						<#if uList??>
							<#list uList as list>
								<option value="${list.username}">${list.nickname}（${list.regions}-${list.departments}-${list.job}）</option>
							</#list>
						</#if>
						<#if uList1??>
							<#list uList1 as list>
								<option value="${list.username}">${list.nickname}（${list.regions}-${list.departments}-${list.job}）</option>
							</#list>
						</#if>
					</select>
					<input type="text" id="sp_user_ipt" size="12" maxlength="10" placeholder="输入快捷匹配">
					
					<p class="line"></p>
					<p class="caption">将该问卷所属的客户资源分配给指定的咨询师进行后续业务跟进，该操作不可撤消且只能进行一次</p>
				</td>
			</tr>
			<tr>
				<th>备注信息</th>
				<td><div id="descs" contenteditable="true">${clientImp.descs}</div>
					<p class="line"></p>
					<p class="caption">仅供后台标记、备注相关信息使用（会在查询列表中显示该备注）</p></td>
			</tr>
		</table>
		<div class="remark">
			<ul>
				<li><span class="title">注意事项：</span></li>
				<li>1、咨询师分配操作只能进行一次，且不可撤消（后续若需另外指定其它咨询需要在OA系统中进行客户转交）</li>
				<li>2、备注信息一般用来标记和指示分配相关的信息，可修改多次</li>
			</ul>
		</div>
		<div>
			<input type="hidden" id="key" value="" />
		</div>
		<div id="controlbar">
		<#if clientImp.state!="1">
			<input id="" onclick="updateClient()" type="button" class="submit" value="  提交分配方案  " />
		</#if>
			<input id="btnCancel" type="button" class="submit" value="  返回列表  " onclick="history.back()" />
		</div>
	</div>
</body>
</html>

